package com.xing.todolist.fragment;

import android.os.Bundle;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;

import androidx.annotation.NonNull;
import androidx.annotation.Nullable;
import androidx.fragment.app.Fragment;

import com.xing.todolist.databinding.TodoEditFragmentBinding;
import com.xing.todolist.db.base.TodoMsg;

public class TodoEditFragment extends Fragment {

    private TodoEditFragmentBinding mBinding;

    public static final String DATA_KEY = "todoMsg";

    @Nullable
    @Override
    public View onCreateView(@NonNull LayoutInflater inflater, @Nullable ViewGroup container, @Nullable Bundle savedInstanceState) {
        mBinding = TodoEditFragmentBinding.inflate(inflater, container, false);

        return mBinding.getRoot();
    }

    @Override
    public void onViewCreated(@NonNull View view, @Nullable Bundle savedInstanceState) {
        super.onViewCreated(view, savedInstanceState);

        Bundle bundle = getArguments();
        if (bundle == null) return;

        TodoMsg todoMsg = (TodoMsg) bundle.getSerializable(DATA_KEY);
        if (todoMsg == null) return;

        mBinding.setData(todoMsg);


    }
}
